<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 26383
  Date: 2020/12/18
  Time: 16:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<html>
<head>
    <title>管理员信息</title>
    <base href="<%=basePath %>">
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>

<body class="layui-layout-body" style="background-color:#2F4056">
<div class="layui-layout layui-layout-admin">
    <jsp:include page="top.jsp" flush="true"></jsp:include>
    <jsp:include page="left.jsp" flush="true"></jsp:include>
    <div class="layui-body">
        <div style="padding: 15px;position: absolute;left: 30%">
            <div class="layui-card" style="width: 400px;height: 550px;">
                <div class="layui-card-header" style="background-color: #FF5722">编辑</div>
                <div style="margin: 5px">
                    <form action="/UpdateNewsInfo" method="post" enctype="multipart/form-data" >
                        <div class="layui-form-item">
                            <input style="display: none" name="id" value="${news.id}">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title" required lay-verify="required"
                                       autocomplete="off" class="layui-input" value="${news.title}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">作者</label>
                            <div class="layui-input-inline">
                                <input type="text" name="author" required lay-verify="required"
                                       autocomplete="off" class="layui-input" value="${news.author}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">时间</label>
                            <div class="layui-input-inline">
                                <input type="date" class="layui-input" name="n_datetime"  value="${news.datetime}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">类别</label>
                            <div class="layui-input-inline">
                                <select name="category" lay-verify="required">
                                    <option value="${news.category}">${news.category}</option>
                                    <c:forEach var="cate" items="${sessionScope.categories}">
                                        <option value="${cate.category}">${cate.category}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">添加者</label>
                            <div class="layui-input-inline">
                                <input type="text" name="addername" value="${news.adder}"
                                       lay-verify="required"
                                       placeholder="请输入添加者账号！" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">图片</label>
                            <div class="layui-input-inline">
                                <input type="file" name="picpath" lay-verify="required" autocomplete="off"
                                       class="layui-btn-sm" value="${news.picadr}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">内容</label>
                            <div class="layui-input-inline">
                                <input type="text" name="main" required lay-verify="required"
                                       autocomplete="off" class="layui-textarea" value="${news.main}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" type="submit">修改</button>
                                <button class="layui-btn" type="reset">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <jsp:include page="footer.jsp" flush="true"></jsp:include>
</div>
<script src="/layui/layui.js"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;
    });

</script>
</body>
</html>